/*
 * VisionManager.h
 *
 *  Created on: Apr 19, 2010
 *      Author: Soheil Damangir
 */

#ifndef VISIONMANAGER_H_
#define VISIONMANAGER_H_
#include <fstream>

#include "camera_reader.h"
#include "image.h"
#include "image_processor.h"
#include "jpeg_buffer.h"
#include "init_systems.h"
#include "log.h"

#include "Normalizer.h"
#include "Detector.h"
#include "../Util/Conf.h"

using namespace kthrobot;

namespace Group5 {

class VisionManager: public ProcessingTask {
public:
  void Up();
  void Down();

  void ProcessImage(Image *image);

  DetectionResults const & getBombResult();
  DetectionResults const & getBallResult();
  DetectionResults const & getStripeResult();


  virtual ~VisionManager();

private:

  Image*last_image;
  JPEGBuffers*jpeg_buffers;
  JPEGQueue*jpeg_queue;

  CameraReader*cam_reader;

  ImageProcessor*processor;

  Detector*ball_detector;
  Detector*bomb_detector;
  Detector*stripe_detector;

  DetectionResults ball_result;
  DetectionResults bomb_result;
  DetectionResults stripe_result;


  VisionManager();
  VisionManager(const VisionManager&);
public:
  static VisionManager& getInstance()
  {
    static VisionManager vm;
    return vm;
  }
};

}

#endif /* VISIONMANAGER_H_ */
